﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace BPM.Base.WFLib.GuideForm
{
	public partial class incept:  BaseForm
	{
		public incept()
		{
			InitializeComponent();
		}
        public incept(WaitSubmitDesigner designer)
            : base(designer)
        {
            InitializeComponent();

                 this.接件部门.Text = activity.接件部门;
                 this.接件职能.Text = activity.接件职能;
                 this.接件时限.Text = activity.接件时限.ToString();
        }

        private void btnGroup_Click(object sender, EventArgs e)
        {
            DepartmentDutyForm dForm = new DepartmentDutyForm();
            dForm.ShowDialog();
            if (dForm.Value != null)
            {
                if (dForm.Value.IndexOf("|") != -1)
                {
                    Button bt = sender as Button;

                  

                    string[] department = dForm.Value.Split('|')[0].Split(',');
                    string[] duty = dForm.Value.Split('|')[1].Split(',');

                    this.接件部门.Text = department[0];
                    this.接件职能.Text = duty[0];
                    

                }
            }
        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.Close();
        }
        public void setIncept()
        {

            activity.接件部门 = this.接件部门.Text;
            activity.接件职能 = this.接件职能.Text;

            //接件时限
            int n;
            if (int.TryParse(this.接件时限.Text, out n))
            {
                activity.接件时限 = n;
            }
            else
            {
                接件时限.Text = activity.接件时限.ToString();
            }
            
        }
        private void button1_Click(object sender, EventArgs e)
        {
            this.setTransact();
            setIncept();
            activity.处理方式 = "组接件";
            this.Close();
        }
	}
}
